/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Review.test2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author THIEN
 */
public class StudentDemo {

    public StudentDemo() {
    }
    static StudentManagement SM= new StudentManagement();
    static InputStreamReader reader = new InputStreamReader(System.in);
    static BufferedReader in = new BufferedReader(reader);
    public void menu() throws IOException{
        int choice;
        do{
        System.out.println("\t1. Input then display");
        System.out.println("\t2. Write to file");
        System.out.println("\t3. Read from file");
        System.out.println("\t4. Search");
        System.out.println("\t5. Exit");
        System.out.println("Enter your choice :");
        choice = Integer.parseInt(in.readLine());
        switch(choice){
            case 1:
                SM.inputData();
                break;
            case 2:
                SM.save2file();
                break;
            case 3:
                SM.readFromFile();
                break;
            case 4:
                SM.searchData();
                break;
            case 5:
                System.exit(0);
            default:
                System.out.println("Invalid choice, try again !");
        }
        }while(choice!=5);
    }
    public static void main(String args[]) throws IOException{
        StudentDemo DM = new StudentDemo();
        DM.menu();
    }

}
